﻿@using System.Data;
@using System.Web;
@using DTcms.Web.MVC.Areas.Web.Controllers;
@using DTcms.Web.MVC.UI.Controllers;
@using DTcms.Model;
@{
  DTcms.Model.sites site = ViewData["site"] as DTcms.Model.sites;
  DTcms.Model.sysconfig config = ViewData["sysConfig"] as DTcms.Model.sysconfig;
  Layout = "~/Areas/Web/Views/" + site.build_path + "/Shared/_LayoutShow.cshtml";
  DTcms.Model.article m = ViewData["model"] as DTcms.Model.article;
  Article_ShowController bc = ViewBag.This as Article_ShowController;
  string category_title = bc.get_category_title(m.category_id, "资源下载");
  ViewBag.Title = m.title + " - " + category_title + " - " + site.name;
  string channel = "down";
  string category_nav = bc.get_category_menu("down_list", m.category_id);
  DataTable categoryList1 = bc.get_category_child_list(channel, 0);//资源类别
  DataTable redList = bc.get_article_list(channel, 0, 5, "status=0 and is_red=1");//推荐资源
  DataTable hotList = bc.get_article_list(channel, 0, 10, "status=0", "click desc,id desc");//人气排行
  DataTable relList = bc.get_article_list(channel, m.category_id, 4, "is_red=1 and id<>" + m.id);//相关资源
}
@section HeaderContent{
  <link href="~/templates/@ViewBag.TemplateSkin/css/lightbox.css" rel="stylesheet" />
  <script src="~/templates/@ViewBag.TemplateSkin/js/lightbox.min.js"></script>
}

<!--当前位置-->
<div class="section">
  <div class="location">
    <span>当前位置：</span>
    <a href="@bc.linkurl("index")">首页</a> &gt;
        <a href="@bc.linkurl("down")">资源下载</a>
    @Html.Raw(category_nav)
  </div>
</div>
<!--/当前位置-->

<div class="section">
  <!--/页面右边-->
  <div class="right-260">
    <div class="bg-wrap nobg">
      <div class="sidebar-box">
        <h4>人气排行</h4>
        <ul class="txt-list">
          @for (int i = 0; i < hotList.Rows.Count; i++) {
            DataRow hotdr = hotList.Rows[i];
            <li>
              <label class="@(i == 0 ? "hot" : "")">@(i + 1)</label>
              <a href="@bc.linkurl("down_show", hotdr["id"])">@hotdr["title"]</a>
            </li>
          }
        </ul>
      </div>

      <div class="sidebar-box">
        <h4>推荐资源</h4>
        <ul class="side-img-list">
          @foreach (DataRow dr in redList.Rows) {
            <li>
              <div class="img-box">
                <a title="@dr["title"]" href="@bc.linkurl("down_show", dr["id"])">
                  <img src="@dr["img_url"]" />
                </a>
              </div>
              <div class="txt-box">
                <a title="@dr["title"]" href="@bc.linkurl("down_show", dr["id"])">@dr["title"]</a>
                <span>@dr["add_time"]</span>
              </div>
            </li>
          }
        </ul>
      </div>

    </div>
  </div>
  <!--/页面右边-->

  <!--页面左边-->
  <div class="left-auto">
    <div class="bg-wrap">
      <div class="meta">
        <h2>@m.title</h2>
        <div class="info">
          <span><i class="iconfont icon-date"></i>@m.add_time</span>
          <span><i class="iconfont icon-comment"></i>
            <script type="text/javascript" src="@(config.webpath)tools/submit_ajax.ashx?action=view_comment_count&channel_id=@m.channel_id&id=@m.id"></script>
            人评论</span>
          <span><i class="iconfont icon-view"></i>
            <script type="text/javascript" src="@(config.webpath)tools/submit_ajax.ashx?action=view_article_click&channel_id=@m.channel_id&id=@m.id&click=1"></script>
            次</span>
        </div>
        <div class="note">
          <p>@m.zhaiyao</p>
        </div>
      </div>

      <div class="entry">
        @Html.Raw(m.content)
      </div>

      <div class="attach-list clearfix">
        <h2 class="slide-tit">
          <span>附件下载</span>
        </h2>
        <ul>
          @if (m.attach != null) {
            foreach (DTcms.Model.article_attach modelt in m.attach) {
            <li>
              <a class="link-btn" href="javascript:;" onclick="downLink(@modelt.point,'@(config.webpath)tools/download.ashx?site=@site.build_path&id=@modelt.id');">
                <i class="iconfont icon-down"></i>下载
              </a>
              <div class="icon-box">
                <i class="iconfont icon-attach"></i>
              </div>
              <div class="info">
                <h3>@modelt.file_name</h3>
                <p>
                  <span>文件类型：@modelt.file_ext</span>
                  <span>大小：@(modelt.file_size > 1024 ? (modelt.file_size / 1024f).ToString("#.##") + "MB" : modelt.file_size + "KB")</span>
                  <span>下载：<script type="text/javascript" src="@(config.webpath)tools/submit_ajax.ashx?action=view_attach_count&id=@modelt.id"></script>次</span>
                  <span>所需积分：@modelt.point</span>
                </p>
              </div>
            </li>
            }
          }
        </ul>
      </div>

      <!--上下一条-->
      <div class="next-box clearfix">
        <p class="prev">上一篇：@Html.Raw(bc.get_prevandnext_article("down_show", -1, "没有了", 0))</p>
        <p class="next">下一篇：@Html.Raw(bc.get_prevandnext_article("down_show", 1, "没有了", 0))</p>
      </div>
      <!--/上下一条-->

      <!--相关资讯-->
      <div class="rel-box">
        <h2 class="slide-tit">
          <span>相关资源</span>
        </h2>
        <ul class="rel-list">
          @foreach (DataRow dr in relList.Rows) {
            <li>
              <div class="img-box">
                <a title="@dr["title"]" href="@bc.linkurl("down_show", dr["id"])">
                  <img src="@dr["img_url"]" />
                </a>
              </div>
              <div class="info">
                <h3><a title="@dr["title"]" href="@bc.linkurl("down_show", dr["id"])">@dr["title"]</a></h3>
                <p>@dr["zhaiyao"]</p>
                <span>@dr["add_time"]</span>
              </div>
            </li>
          }
          @if (relList.Rows.Count < 1) {
            <div class="nodata">暂无相关数据...</div>
          }
        </ul>
      </div>
      <!--/相关资讯-->

      <!--网友评论-->
      @if (m.is_msg == 1) {
        <div class="comment-box">
          <h2 class="slide-tit">
            <strong>共有<script type="text/javascript" src="@(config.webpath)tools/submit_ajax.ashx?action=view_comment_count&channel_id=@m.channel_id&id=@m.id"></script>条评论</strong>
            <span>网友评论</span>
          </h2>
          @RenderPage("~/Areas/Web/Views/"+ site.build_path +"/Shared/partial_comment_box.cshtml")
        </div>
      }
      <!--/网友评论-->

    </div>
  </div>
  <!--/页面左边-->
</div>
